/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

function cacheController(){
    
    this.init = function(){
        sessionStorage.ts = JSON.stringify(new Array());
    }

    this.getTimestamp = function(id){
        var tss = JSON.parse(sessionStorage.ts);
        var res = tss[id];
        if (res == null){
            var ts = "?ts="+new Date().getTime();
            tss[id] = ts;
            sessionStorage.ts = JSON.stringify(tss);
            return ts;
        }
        else return res;
    }
    
    this.updateTimestamp = function(id){
        var tss = JSON.parse(sessionStorage.ts);
        var ts = "?ts="+new Date().getTime();
        tss[id] = ts;
        sessionStorage.ts = JSON.stringify(tss);
        return ts;
    }
    
}
